//
//  DiscoverCard.swift
//  SwiftUIStacks
//
//  Created by 李煜 on 2024/7/31.
//

import SwiftUI

struct DiscoverCard: View {
    var body: some View {
      ZStack {
        
        CardItem(icon:"burst.fill", title: "Basic", price: "$9", textColor: .white, bgColor: .purple)
          .padding()
          .background(.cyan)
      
      }
    }
  }
  struct CardItem : View {
    var icon: String
    var title: String
    var price: String
    var textColor: Color
    var bgColor: Color
    var body: some View {
      VStack {
        Image(systemName: icon)
          .font(.largeTitle)
          .foregroundStyle(textColor)
        Text(title)
          .font(.system(.title, design: .rounded, weight: .semibold))
          .foregroundStyle(textColor)
        Text(price)
          .font(.system(size: 40, weight: .black, design: .rounded))
          .foregroundStyle(textColor)
        Text("per month")
          .font(.headline)
          .foregroundStyle(.white)
        
      }
      .background(.red)
      //注意看下面一行代码导致全宽尺寸
//      .frame(minWidth: 0, maxWidth: .infinity, minHeight: 100)
      .padding(40)
      .background(bgColor)
      .cornerRadius(10)
      
      
    }
  }
#Preview {
    DiscoverCard()
}
